<?php 

	// PinAJAX.php
	// includes basic JavaScript function to auto-refresh a dynamic content area
	// when a URL-encoded action is called

?>
	function AJAXAction(scriptURL)
	{
		<?php include "ajax_init.php"; ?>
          
		request.open("GET", scriptURL, true);
		
		request.onreadystatechange = function()
		{
			if(request.readyState == 4)
			{
				var responseText = request.responseText;
				document.getElementById('dynamic_content').innerHTML = responseText;
			}
		}

		request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		request.send(null); 
	}
	
	function AJAXActionL(scriptURL, index)
	{
		<?php include "ajax_init.php"; ?>
          
		document.getElementById('ajax_' + index).style.display = "inline";
		
		request.open("GET", scriptURL, true);
		
		request.onreadystatechange = function()
		{
			if(request.readyState == 4)
			{
				var responseText = request.responseText;
				document.getElementById('dynamic_content').innerHTML = responseText;
			}
		}

		request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		request.send(null); 
	}